{include file="header"}
<div style="padding: 20px;">
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  <ul class="layui-tab-title">
    <a href="/admin.php/addons/index.html"><li>本地插件</li></a>
    <a href="/admin.php/addons/zaixian.html"><li class="layui-this">在线插件</li></a>
  </ul>
  <div class="layui-tab-content"></div>
</div>   
<div style="overflow: auto;">
<table class="layui-table adminmyucms" lay-size="lg">
  <colgroup>
    <col width="150">
    <col width="200">
    <col>
  </colgroup>
  <thead>
    <tr>
      <th>图标</th>
      <th>插件名</th>
      <th>版本</th>
      <th>价格</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
{volist name=":myaddons()" id="vo"}
    <tr>
      <td><a href="http://www.115cms.com/s_dow_{$vo.id}.html" target="_blank"><div align="center"> <img src="{$vo.pic}" alt="{$vo.title}" width="60" height="60"></div></a></td>
      <td><a href="http://www.115cms.com/s_dow_{$vo.id}.html" target="_blank">{$vo.title}</a></td>
      <th>V {$vo.banben}</th>
      <th>{if condition="$vo['fufei'] eq '1'"}￥ {$vo.jifen} 元{else /}免费{/if}</th>
      <th><button class="layui-btn layui-btn-normal layui-btn-mini xiazai"  lay-submit="" nickname="{$vo.biaoshi}" nickid="{$vo.id}">下载</button></th>
    </tr>
{/volist}
  </tbody>
</table>
</div>    
</div>  
{include file="footer"}
<script>
layui.use('form',function(){
  var form = layui.form
  ,jq = layui.jquery;
  jq('.xiazai').click(function(){
    var name = jq(this).attr('nickname');
  	var id = jq(this).attr('nickid');
    layer.confirm('确定要下载吗？下载后会覆盖原有的插件 记得备份哦', function(data) {
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
   	jq.post('/admin.php/addons/xiazai.html?info='+name+'&id='+id+'',param,function(data){
        if(data.code == 1){
          layer.close(loading);
          var downurl=data.path;
          layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.href = '/admin.php/addons/ad.html'; 
          });
        }else{
          layer.close(loading);
          var downurl=data.path;
          layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
          window.open(''+downurl+'','_blank');
        }
    });
  	});
    return false;
  });

});
</script>
